<%@ page import="com.abtu.sms.pojo.Course" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<html>
<head>
    <title>我的授课</title>
    <link rel="stylesheet" href="http://localhost:8080/studentmanagesystem/css/layui.css">
    <link rel="stylesheet" href="http://localhost:8080/studentmanagesystem/css/styles.css">
    <script src="http://localhost:8080/studentmanagesystem/layui.js"></script>
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
</head>
<body class="layui-layout-body" style="background-color: #F2F2F2">
<jsp:include page="/teacher/tHeader.jsp"></jsp:include>
<jsp:include page="/teacher/teacherNav.jsp"></jsp:include>
<div class="layui-layout layui-layout-admin">
    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">
                <span class="layui-breadcrumb">
                    <a href="">教师端</a>
                    <a href="">课程信息</a>
                    <a><cite>我的授课</cite></a>
                </span>
            <table class="layui-table" lay-filter="test">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>课程号</th>
                    <th>课程名</th>
                    <th>课程简介</th>
                    <th>操作</th>
                </tr>
                </thead>
                <%
                    List<Course> mySelfOptionalCourse = (List<Course>) request.getSession().getAttribute("cs");
                    for (int i = 0; i < mySelfOptionalCourse.size(); i++) {
                        %>
                        <tr>
                            <td><%=i+1%></td>
                            <td><%=mySelfOptionalCourse.get(i).getCid()%></td>
                            <td><%=mySelfOptionalCourse.get(i).getCname()%></td>
                            <td><%=mySelfOptionalCourse.get(i).getCinfo()%></td>
                            <td><a class="layui-btn" href="../course/findstudentcourse/<%=mySelfOptionalCourse.get(i).getCid()%>">查看</a><a class="layui-btn layui-btn-danger" href="javascript:deleteOptionalCourse(<%=mySelfOptionalCourse.get(i).getCid()%>);">删除</a></td>
                        </tr>
                <%
                    }
                %>
            </table>

        </div>
    </div>
</div>




<script type="text/javascript">
    $("#nav li:nth-child(1) dl dd:nth-child(1)").addClass("layui-this");
    $("#nav li:nth-child(1)").addClass("layui-nav-itemed");
</script>
<script>
    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element;
        element.init();
    });
</script>
<script type="text/javascript">
    function deleteOptionalCourse(cid) {
        if (confirm("你确定删除授课吗？")) {
            location.href = "../course/deletecourse/"+cid;
        }
    }
</script>
<%--<%=request.getSession().getAttribute("cs")%>--%>
</body>
</html>
